package com.suse.lhw.hms.exersiseserver.service.Impl;

import com.suse.lhw.hms.exersiseserver.dao.EPackageMapper;
import com.suse.lhw.hms.exersiseserver.domin.EModelsOfPackage;
import com.suse.lhw.hms.exersiseserver.domin.EPackage;
import com.suse.lhw.hms.exersiseserver.pojo.out.PackageAndModels;
import com.suse.lhw.hms.exersiseserver.service.EPackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceChain;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.suse.lhw.hms.exersiseserver.domin.EPackageInstance;
import com.suse.lhw.hms.exersiseserver.dao.EPackageInstanceMapper;
import com.suse.lhw.hms.exersiseserver.service.EPackageInstanceService;

import java.util.Date;
import java.util.List;

/**
 * @ProjectName: health_manage_system
 * @Package: com.suse.lhw.hms.exersiseserver.service.Impl
 * @ClassName: EPackageInstanceServiceImpl
 * @Description: java类作用描述
 * @Author: 李鸿炜
 * @CreateDate: 2020/5/3 21:26
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/5/3 21:26
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@Service
public class EPackageInstanceServiceImpl implements EPackageInstanceService {
    @Autowired
    private EPackageService ePackageService;
    @Resource
    private EPackageMapper ePackageMapper;

    @Resource
    private EPackageInstanceMapper ePackageInstanceMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return ePackageInstanceMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(EPackageInstance record) {
        return ePackageInstanceMapper.insert(record);
    }

    @Override
    public int insertSelective(EPackageInstance record) {
        return ePackageInstanceMapper.insertSelective(record);
    }

    @Override
    public EPackageInstance selectByPrimaryKey(Integer id) {
        return ePackageInstanceMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(EPackageInstance record) {
        return ePackageInstanceMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(EPackageInstance record) {
        return ePackageInstanceMapper.updateByPrimaryKey(record);
    }

    @Override
    public int exuteAPackage(EPackage ePackage) {
        PackageAndModels lsit = ePackageService.selectAPackageById(ePackage.getId());
        List<EModelsOfPackage> model = lsit.getList();
        //计算出每个模型所消耗的热量
        for (EModelsOfPackage modelsOfPackage : model) {

        }
//        EPackageInstance ePackageInstance=new EPackageInstance(ePackage.getId(),new Date(),);
        return 1;
    }

}

